<template>
	<view class="cunwugongkai">
		<u-sticky offset-top="44" v-if="pageType==='gz_cwgk'">
			<u-tabs class="bgcolor1 border-bottom" :list="list1" @click="changeClick" lineColor="#507EF7" lineWidth="40"
				:lineHeight="6" :activeStyle="{color:'#507EF7'}"></u-tabs>
		</u-sticky>
		<view class="flex flex-column bgcolor1 border-bottom p-2 msgitem" v-for="(item,index) in dataList" :key="index"
			@click="navTo(item)">
			<view class="flex align-center">
				<image style="width: 20px;height: 20px;" src="/static/images/msg2.png" mode="widthFix"></image>
				<text class="fs-28 ftcolor1 ml-1">{{item.department.name}}</text>
				<text class="fs-24 ftcolor4 px-2 py-1">射洪市</text>
			</view>
			<view class="fs-32 ftcolor1 my-1">{{item.title}}</view>
			<view class="ftcolor4 fs-24">2024-05-28 11:50:23</view>
		</view>
		<noneBox v-if="dataList.length === 0"></noneBox>
	</view>
</template>

<script>
	import baseApi from '@/api/baseApi.js'
	export default {
		data() {
			return {
				list1: [{
					name: '党务公开',
				}, {
					name: '政务公开',
				}, {
					name: '财务公开'
				}],
				curType: 1,
				dataList: [],
				pageType: 'gz_cwgk'
			}
		},
		onLoad() {
			uni.setNavigationBarTitle({
				title: this.$route.query.title
			});
		},
		created() {
			this.pageType = this.$route.query.type
			if (this.pageType) {
				this.loadData()
			}
		},
		methods: {
			loadData() {
				baseApi[this.pageType]({
					region_id: this.$route.query.id,
					type: this.curType
				}).then(res => {
					this.dataList = res.data
					uni.hideLoading()
				})
			},
			navTo(item) {
				uni.setStorageSync('curdetails', item)
				uni.navigateTo({
					url: '/pages/details/details?title=' + item.title
				})
			},
			changeClick(item) {
				this.curType = item.index + 1
				this.dataList = []
				uni.showLoading()
				this.loadData()
				console.log('item', item);
			}
		}
	}
</script>

<style lang="scss">
	.cunwugongkai {}
</style>